package com.example.homework;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

public class FinalActivity extends AppCompatActivity {
    TextView text2;
    int energy;
    int happiness;
    int study;
    int love;
    int friendship;
    int honour;
    private ImageView imageView1 = null;
    private ImageView imageView2 = null;
    private ImageView imageView3 = null;
    private ImageView imageView4 = null;
    private ImageView imageView5 = null;
    private ImageView imageView6 = null;
    TextView one;
    TextView two;
    TextView three;
    TextView four;
    TextView five;
    TextView six;


    int flag4=0;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_final);
        text2=findViewById(R.id.textView2);
        Intent intent=getIntent();
        energy=intent.getIntExtra("energy",0);
        happiness=intent.getIntExtra("happiness",0);
        study=intent.getIntExtra("study",0);
        love=intent.getIntExtra("love",0);
        friendship=intent.getIntExtra("friendship",0);
        honour=intent.getIntExtra("honour",0);
        int flag3=intent.getIntExtra("flag3",0);//记录是否挂科
        text2.setText("活力："+energy+"   "+"快乐："+happiness+"\n学习："+study+"   "+"荣誉："+honour+
                "\n爱情："+love+"   "+"友情："+friendship);
        imageView1 = findViewById(R.id.jiesuo1);
        imageView2 = findViewById(R.id.jiesuo2);
        imageView3 = findViewById(R.id.jiesuo3);
        imageView4 = findViewById(R.id.jiesuo4);
        imageView5 = findViewById(R.id.jiesuo5);
        imageView6 = findViewById(R.id.jiesuo6);
        one=findViewById(R.id.one);
        two=findViewById(R.id.two);
        three=findViewById(R.id.three);
        four=findViewById(R.id.four);
        five=findViewById(R.id.five);
        six=findViewById(R.id.six);

    }
    public void click(View btn){
        if(energy>=5){
            imageView1.setVisibility(View.VISIBLE);
            one.setVisibility(View.VISIBLE);
        }
        if(love==5){
            imageView2.setVisibility(View.VISIBLE);
            two.setVisibility(View.VISIBLE);
        }
        if(study>=5){
            imageView3.setVisibility(View.VISIBLE);
            three.setVisibility(View.VISIBLE);
        }
        if(happiness>=15) {
            imageView4.setVisibility(View.VISIBLE);
            four.setVisibility(View.VISIBLE);
        }
        if(friendship>=3) {
            imageView5.setVisibility(View.VISIBLE);
            five.setVisibility(View.VISIBLE);
        }
        if(honour>=8) {
            imageView6.setVisibility(View.VISIBLE);
            six.setVisibility(View.VISIBLE);
        }
        else if(btn.getId()==R.id.button1){
            Intent intent1 = new Intent(this, FirstActivity.class);
            startActivityForResult(intent1,1);
        }
    }
}